package com.liuyang.demo.mybatis.enums.handler;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.Maps;

import java.util.Collections;
import java.util.Map;

/**
 * @author ：jiangqiang
 * @date ：Created in 2020/12/2 11:20
 * @description：处方产品服务单来源
 * @modified By：
 * @version: 1.0$
 */
@JsonSerialize(using = BaseEnumInterfaceJsonSerializer.class)
public enum ServiceOrderSourceType implements BaseEnumInterface {
    /**
     * 处方产品服务单来源
     */
    CMS_ORDER(1, "CMS后台创建"),
    DM_ORDER(2, "D端后台"),
    SHOP_ORDER(3, "线下门店"),
    XT_WECHAT(4, "邢台公众号")
    ;

    private int value;
    private String name;

    ServiceOrderSourceType(int value, String name) {
        this.value = value;
        this.name = name;
    }

    @Override
    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    @Override
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private static Map<Integer, ServiceOrderSourceType> VALUE_MAP = Maps.newHashMap();

    @JsonCreator
    public static ServiceOrderSourceType get(Integer value) {
        return VALUE_MAP.get(value);
    }

    static {
        for (ServiceOrderSourceType element : ServiceOrderSourceType.values()) {
            VALUE_MAP.put(element.getValue(), element);
        }
        VALUE_MAP = Collections.unmodifiableMap(VALUE_MAP);
    }


}
